package main;

import logic.ArrayComparer;
import logic.ArraySizeException;

public class Main {

	public static void main(String[] args){
		ArrayComparer comparer = new ArrayComparer();
		
		System.out.println("Main : Creating test 1");
		int[] array1 = {1, 3, 8};
		int[] array2 = {5, 2, 9};
		
		Main.runTest(comparer, array1, array2);
		
		System.out.println("Main : Creating test 2");
		int[] array3 = {1, 2, 3, 8};
		int[] array4 = {6, 4};
		
		Main.runTest(comparer, array2, array3);
		
		System.out.println("Main : Creating test 3");
		int[] array5 = {1, 3, 8, 10, 3572835, 20};
		int[] array6 = {5, 2, 9, 5342, -10, 256};
		
		Main.runTest(comparer, array5, array6);
	}
	
	private static void runTest(ArrayComparer comparer, int[] array1, int[] array2){
		System.out.println("First Array is :");
		
		System.out.println("{ ");
		for(int i : array1){
			System.out.println( i );
		}
		System.out.println("} ");
		
		System.out.println("Second Array is :");
		
		System.out.println("{ ");
		for(int i : array2){
			System.out.println( i );
		}
		System.out.println("} ");
		
		try{
			int[] result = comparer.sumIntArray(array1, array2);
			
			System.out.println("Result Array is :");
			
			System.out.println("{ ");
			for(int i : result){
				System.out.println( i );
			}
			System.out.println("} ");
			
		}catch(ArraySizeException ae){
			System.out.println(ae.getMessage());
		}finally{
			System.out.println("\n");
		}
	}
}
